import axios from '@/libs/api.request'
import qs from 'querystring'
export const getAllRoles = () => {
  return axios.request({
    url: 'sysRole/search',
    method: 'get'
  })
}

export const create = (role) => {
  let data = qs.stringify(role)
  return axios.request({
    url: '/sysRole/add',
    data,
    method: 'post'
  })
}

export const remove = (ids) => {
  let params = qs.stringify({ ids })
  console.log(params)
  return axios.request({
    url: '/sysRole/delete?' + params,
    // params: {ids:par},
    method: 'get'
  })
}

export const getRole = id => {
  return axios.request({
    url: '/sysRole/view',
    params: id,
    method: 'get'
  })
}

export const update = role => {
  let data = qs.stringify(role)
  return axios.request({
    url: '/sysRole/update',
    data,
    method: 'post'
  })
}
